home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / modelers / geomview / source.lha / Geomview / include / sl2c.h < prev    next >
C/C++ Source or Header  |  1993-02-02  |  2KB  |  78 lines

  1. /*---------------------------------------------------------------------------*/
  2. /*   TYPEFILE.H                                                              */
  3. /*---------------------------------------------------------------------------*/
  4.  
  5. #include <stdio.h>
  6. #include <math.h>
  7. #ifdef NeXT
  8. #include <sys/malloc.h>
  9. #else /* any other reasonable UNIX */
  10. #include <malloc.h>
  11. #endif
  12.  
  13. #define INFINITY HUGE_VAL
  14. /* change HUGE to HUGE_VAL if you are working on the iris */
  15.  
  16. #define V_IS_INFINITY(z) ((*z)[0] == INFINITY)
  17. #define EPSILON 1e-07
  18.  
  19. #define COMPRINT(z) (printf ("%.15f + %.15f i\n", z.real, z.imag))
  20. #define VEC3PRINT(v) (printf ("%lf %lf %lf\n", (*v)[0], (*v)[1], (*v)[2]))
  21. #define VEC4PRINT(v)     \
  22.                (printf ("%lf %lf %lf %lf\n\n",(*v)[0],(*v)[1],(*v)[2],(*v)[3]))
  23.  
  24. #define CHECK_MEM(ptr) if (! ptr) {printf ("Out of memory.\n"); exit (1);}
  25.  
  26. #define MODULUS(z) (sqrt (z.real * z.real + z.imag * z.imag))
  27.  
  28. typedef struct {
  29.     double real, imag;
  30. } complex;
  31.  
  32.  
  33. typedef complex lin_frac[2][2];
  34.  
  35. #ifndef _proj_matrix_
  36. #define _proj_matrix_
  37. typedef double proj_matrix[4][4];
  38. #endif
  39.  
  40.  
  41. typedef double vec3[3];
  42. typedef double vec4[4];
  43.  
  44.  
  45.  
  46. /* in complex.c */
  47. extern complex        zero;
  48. extern complex         plus ();
  49. extern complex        minus ();
  50. extern complex        times ();
  51. extern complex         div ();
  52. extern complex         conjugate ();
  53.  
  54. /* in fourtuple.c */
  55. extern vec4        *svmul4 ();
  56. extern double         innerproduct3 ();
  57. extern void        mat4print ();
  58. extern void        matmatmul4 ();
  59. extern vec4        *vecmatmul4 ();
  60. extern vec4        *normalize4 ();
  61.  
  62.  
  63. /* in hyp3.c */
  64. extern vec4        *conf2proj ();
  65. extern vec4         *proj2conf ();
  66. extern vec3        *ball2hs ();
  67. extern vec4        *hs2ball ();
  68. extern proj_matrix    *Ta ();
  69. extern vec4        *e_sub_i ();
  70. extern void    sl2c2proj ();
  71.  
  72.  
  73. /* in linfrac.c */
  74. extern void        lf_print ();
  75. extern lin_frac        *lf_mult ();
  76. extern lin_frac        *lf_inverse ();
  77. extern vec3        *lfqmul ();
  78.